import "package:dio/dio.dart";
import "package:ct_pa_majordomo/utils/request.dart";

class CollectApi {

  /* 获取采集器列表 */
  Future<Map> getCollects(queryParameters) async {
    Response response = await request.get(
      "apartment/collect/list",
      queryParameters: queryParameters,
    );
    return response.data ?? {};
  }

  /* 获取采集器信息 */
  Future<Map> getCollectInfo(collectId) async {
    Response response = await request.get(
      "apartment/collect/$collectId",
    );
    return response.data ?? {};
  }

  /* 新增采集器 */
  Future<Map> saveCollect(parameters) async {
    Response response = await request.post(
      "apartment/collect",
      data: parameters,
    );
    return response.data ?? {};
  }

  /* 删除采集器 */
  Future<Map> removeCollect(collectId) async {
    Response response = await request.delete(
      "apartment/collect/$collectId",
    );
    return response.data ?? {};
  }

  /* 采集器关联列表 */
  Future<Map> collectBindAmmeterList(collectId) async {
    Response response = await request.get(
      "apartment/ammeter/collect/$collectId/list",
    );
    return response.data ?? {};
  }
}

CollectApi collectApi = CollectApi();